<?php
namespace Common\Model;
use Common\Model\BaseModel;
use Think\Model;

/**
 * Class ModuleModel
 * @package Home\Model
 * 模块模型
 */
class ModuleModel extends BaseModel {

    public function is_installed($name){
        $map['module'] = array('eq', $name);
        $one = $this->where($map)->find();
        return $one ? $one : false;
    }

    public function query_module($name){
        $map['module'] = array('eq', $name);
        $one = $this->where($map)->find();
        return $one ? $one : false;
    }

    public function del_module($name){
        if(!$name){
            return false;
        }
        $one = $this->queryObj($name, 'module');
        if(!$one){
            return false;
        }
        $map['module'] = array('eq', $name);
        return $this->where($map)->delete();
    }
}